/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package py.com.peluq.model.entity;

import java.io.Serializable;
import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author Diego_M
 */
@Entity
@Table(name = "nota_remi_det", catalog = "peludb", schema = "")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "NotaRemiDet.findAll", query = "SELECT n FROM NotaRemiDet n"),
    @NamedQuery(name = "NotaRemiDet.findByReCod", query = "SELECT n FROM NotaRemiDet n WHERE n.notaRemiDetPK.reCod = :reCod"),
    @NamedQuery(name = "NotaRemiDet.findByProdCod", query = "SELECT n FROM NotaRemiDet n WHERE n.notaRemiDetPK.prodCod = :prodCod"),
    @NamedQuery(name = "NotaRemiDet.findByCantidad", query = "SELECT n FROM NotaRemiDet n WHERE n.cantidad = :cantidad")})
public class NotaRemiDet implements Serializable {
    private static final long serialVersionUID = 1L;
    @EmbeddedId
    protected NotaRemiDetPK notaRemiDetPK;
    @Column(name = "cantidad")
    private Integer cantidad;
    @JoinColumn(name = "prod_cod", referencedColumnName = "prod_cod", nullable = false, insertable = false, updatable = false)
    @ManyToOne(optional = false)
    private Productos productos;
    @JoinColumn(name = "re_cod", referencedColumnName = "re_cod", nullable = false, insertable = false, updatable = false)
    @ManyToOne(optional = false)
    private NotasRemi notasRemi;

    public NotaRemiDet() {
    }

    public NotaRemiDet(NotaRemiDetPK notaRemiDetPK) {
        this.notaRemiDetPK = notaRemiDetPK;
    }

    public NotaRemiDet(int reCod, int prodCod) {
        this.notaRemiDetPK = new NotaRemiDetPK(reCod, prodCod);
    }

    public NotaRemiDetPK getNotaRemiDetPK() {
        return notaRemiDetPK;
    }

    public void setNotaRemiDetPK(NotaRemiDetPK notaRemiDetPK) {
        this.notaRemiDetPK = notaRemiDetPK;
    }

    public Integer getCantidad() {
        return cantidad;
    }

    public void setCantidad(Integer cantidad) {
        this.cantidad = cantidad;
    }

    public Productos getProductos() {
        return productos;
    }

    public void setProductos(Productos productos) {
        this.productos = productos;
    }

    public NotasRemi getNotasRemi() {
        return notasRemi;
    }

    public void setNotasRemi(NotasRemi notasRemi) {
        this.notasRemi = notasRemi;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (notaRemiDetPK != null ? notaRemiDetPK.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof NotaRemiDet)) {
            return false;
        }
        NotaRemiDet other = (NotaRemiDet) object;
        if ((this.notaRemiDetPK == null && other.notaRemiDetPK != null) || (this.notaRemiDetPK != null && !this.notaRemiDetPK.equals(other.notaRemiDetPK))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "py.com.peluq.model.entity.NotaRemiDet[ notaRemiDetPK=" + notaRemiDetPK + " ]";
    }
    
}
